package org.jluzhCS.mylogin.interceptor;

import com.opensymphony.xwork2.Action;
import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionInvocation;
import com.opensymphony.xwork2.interceptor.AbstractInterceptor;

public class checkuser extends AbstractInterceptor
{

    @Override
    public String intercept(ActionInvocation invocation) throws Exception
    {
	ActionContext ctx = invocation.getInvocationContext();
	String userType = (String) ctx.getSession().get("userType");
	if (userType.equals("admin"))
	    return invocation.invoke();
	else
	    return "noAdmin";
	// return Action.LOGIN;
    }

}
